package day4.homework;

import java.lang.reflect.Array;

//b.使用反射创建长度为5的String数组,为数组的前三个元素赋值："A", "B", "C"。
//打印数组的内容。(提示:Array.newInstance 来实例化数组)
public
class Demo2 {
    public static
    void main(String[] args) throws ClassNotFoundException {
        Object s=  Array.newInstance(String.class, 5);
        Array.set(s,0,"A");
        Array.set(s,1,"B");
        Array.set(s,2,"C");
        for (int i=0;i<Array.getLength(s);i++){
            System.out.println(Array.get(s,i));
        }
    }
}
